//
//  ActivityIndicatorCustom.m
//  ClienteHabitueIOS
//
//  Created by Mauro Carreño on 5/29/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ActivityIndicatorCustom.h"

@implementation ActivityIndicatorCustom

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
    
    }
    return self;
}




// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    //Create the first status image and the indicator view
    UIImage *statusImage = [UIImage imageNamed:@"loader01.png"];
    UIImageView *activityImageView = [[UIImageView alloc] 
                                      initWithImage:statusImage];
    
    
    //Add more images which will be used for the animation
    activityImageView.animationImages = [NSArray arrayWithObjects:
                                         [UIImage imageNamed:@"loader01.png"],
                                         [UIImage imageNamed:@"loader02.png"],
                                         [UIImage imageNamed:@"loader03.png"],
                                         [UIImage imageNamed:@"loader04.png"],
                                         [UIImage imageNamed:@"loader05.png"],
                                         [UIImage imageNamed:@"loader06.png"],
                                         [UIImage imageNamed:@"loader07.png"],
                                         [UIImage imageNamed:@"loader08.png"],
                                         [UIImage imageNamed:@"loader09.png"],
                                         [UIImage imageNamed:@"loader10.png"],
                                         [UIImage imageNamed:@"loader11.png"],
                                         [UIImage imageNamed:@"loader12.png"],
                                         nil];
    
    
    //Set the duration of the animation (play with it
    //until it looks nice for you)
    activityImageView.animationDuration = 0.5;
    
    
    //Position the activity image view somewhere in 
    //the middle of your current view
    activityImageView.frame = CGRectMake( 0,0, statusImage.size.width*0.5, statusImage.size.height*0.5);
    
    //Start the animation
    [activityImageView startAnimating];
    
    
    //Add your custom activity indicator to your current view
    [self addSubview:activityImageView]; 
    [activityImageView release];

}


@end
